<%@page import="java.net.URLEncoder"%>
<%@page import="org.apache.struts2.ServletActionContext"%>
<%@page import="java.io.File"%>
<%@page import="com.daigoudao.config.ConfigManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:include value="/comm/header.jsp" />
<s:include value="/comm/menu.jsp" />
<!--第1部分开始  -->
<div class="wrap1">
	<div class="blank1"></div>
	<s:form action="canBuyList" method="get" id="search">
		<s:hidden id="categoryId" name="category" />
		<s:hidden id="areaId" name="area" />
		<s:hidden id="tagId" name="tag" />
		<s:hidden id="pubtime" name="pubtime" />
    	<s:hidden id="pageSize" name="pageSize" />
    	<input type="hidden" id="superPage" name="superPage" value="1" />
		<div class="outbox2">
			<div class="sort_list1">
				<ul>
					<li>
						【类别】 
						<s:iterator value="categorys" status="st">
            				&nbsp;&nbsp;
            				<s:if test="categoryId==category">
								<span class="span21"><s:property value="categoryName" /></span>
							</s:if>
							<s:else>
								<a href="javascript:query(1, <s:property value='categoryId' />);" ><s:property
											value="categoryName" /></a>
							</s:else>
							
						</s:iterator>
					</li>
					<li>
					   【区域】 <s:iterator value="areas">
            			&nbsp;&nbsp;
            			<s:if test="areaId == area">
								<span class="span21"><s:property value="areaName" /></span>
							</s:if>
							<s:else>
								<a href="javascript:query(2, <s:property value='areaId' />);" ><s:property
											value="areaName" /></a>
							</s:else>
						</s:iterator>
					</li>
					<li>
						【发布时间】 
						<s:iterator value='#{"0":"不限", "1":"1周内","2":"1月内","3":"三个月内" }'>
                			&nbsp;&nbsp;
                			<s:if test="pubtime == key">
									<span class="span21"><s:property value="value" /></span>
							</s:if>
							<s:else>
								<a href="javascript:query(3, <s:property value='key' />);" ><s:property
											value="value" /></a>
							</s:else>
						</s:iterator>
					</li>
					<li id="tag">
					       【热门标签】 
					       <s:iterator value="topTags">
                			&nbsp;&nbsp;
                			<s:if test="tagId == tag">
									<span class="span21"><s:property value="tagName" /></span>
							</s:if>
							<s:else>
								<a
									href="javascript:query(4, <s:property value='tagId' />);"><s:property
											value="tagName" /></a>
							</s:else>
						</s:iterator>
					</li>
				</ul>
			</div>
			<div class="bg_line2">
				<div class="span22">输入关键字：</div>
				<div class="searchbox1">
					<s:textfield name="q" style="border:none;liine-height:22px;height:22px;" />
					<input name="" type="button" value="搜索" class="input3" id="searchBtn" />
				</div>
				<div class="span23">
					<input name="" type="button" value="重置所有条件" class="input4"
						onclick="javascript:window.location.href='canBuyList.htm'" />
				</div>
				<div class="clear"></div>
			</div>
		</div>
	</s:form>



	<div class="blank1"></div>

	<div class="outbox2" id="canBuyList">
		<div class="agent_show_tt">
			<span class="span24">共有 <span class="showtxt4"><s:property
						value="totalSize" /></span> 件代购信息
			</span>
			<span class="span25">
				<strong>每页显示：</strong>
				<s:if test="pageSize == 10">
            		10&nbsp;&nbsp;<a href="javascript:setPageSize(20);">20</a>&nbsp;&nbsp;<a href="javascript:setPageSize(30);">30</a>	
            	</s:if>
            	<s:elseif test="pageSize == 20">
            		<a href="javascript:setPageSize(10);">10</a>&nbsp;&nbsp;20&nbsp;&nbsp;<a href="javascript:setPageSize(30);">30</a>
            	</s:elseif>
            	<s:elseif test="pageSize == 30">
            		<a href="javascript:setPageSize(10);">10</a>&nbsp;&nbsp;<a href="javascript:setPageSize(20);">20</a>&nbsp;&nbsp;30
            	</s:elseif>
            	<s:else>
            		<a href="javascript:setPageSize(10);">10</a>&nbsp;&nbsp;<a href="javascript:setPageSize(20);">20</a>&nbsp;&nbsp;<a href="javascript:setPageSize(30);">30</a>
            	</s:else>
			</span>
			<div class="clear"></div>
		</div>
		<!--列表开始-->
		<div class="show_list4">
			<ul>
				<s:if test="totalSize == 0">
    				抱歉！没有找到相关的代购信息。
    			</s:if>
				<s:else>
					<!--循环开始-->
					<s:iterator value="canBuyModels">
						<li>
							<span class="showpic1"><a href="canBuyDetail.htm?canBuyModel.canId=<s:property value='canId' />" target="_blank"><img src="<s:property value='image200' />" /></a></span><br /> 
							<span class="showtxt1">
								<span class="show_list1_tt">
									<a href="canBuyDetail.htm?canBuyModel.canId=<s:property value='canId' />" target="_blank"><s:property value="goodsName" /></a>
								</span><br /> 
								
								<span class="span1">价格：</span><span class="span2">￥<s:property value="price" /></span><br />
                                <span class="span1">佣金</span>：<span>${serviceFee}</span><span class="span1">　|　<s:property value="areaName" /></span><br />
                                <span class="span1"><a href="brokerDetail.htm?id=<s:property value='user.userid' />"  target="_blank"><s:property value='user.nickName' /></a></span><span class="span1">　|　已有<s:property value='transNum' />人代购</span>
							</span>
						</li>
					</s:iterator>
					<!--循环结束-->
				</s:else>
			</ul>
			<div class="clear"></div>
		</div>

		<!--页码开始-->
		<div class="page_box">
			<div class="pagewrap">
				<div class="page" id="page">
					<s:if test="totalSize > 0">
						<ul>
							<s:if test="superPage == 1">
								<li>首页</li>
								<li>上一页</li>
							</s:if>
							<s:else>
								<li><a href="javascript:page(1);">首页</a></li>
								<li><a href="javascript:page(<s:property value='superPage' /> -1);">上一页</a></li>
							</s:else>
							<s:iterator value="pageList" status="st">
								<s:if test="pageNumber == '...'">
									<li><s:property value='pageNumber' /></li>
								</s:if>
								<s:elseif test="choose">
									<li class="thisclass"><s:property value='pageNumber' /></li>
								</s:elseif>
								<s:else>
									<li><a href="javascript:page(<s:property value='pageNumber' />);"><s:property value='pageNumber' /></a></li>
								</s:else>
								
							</s:iterator>
							<s:if test="superPage == totalPage">
								<li>下一页</li>
								<li>末页</li>
							</s:if>
							<s:else>
								<li><a href="javascript:page(<s:property value='superPage' /> + 1);">下一页</a></li>
								<li><a href="javascript:page(<s:property value='totalPage' />">末页</a></li>
							</s:else>
							<li><span class="pageinfo">共 <strong><s:property value='totalPage' /></strong>页<strong><s:property value='totalSize' /></strong>条
							</span></li>
							<div class="clear"></div>
						</ul>
					</s:if>

				</div>
			</div>

		</div>
		<!--页码结束 -->

		<!--列表结束-->

	</div>

</div>
<s:include value="/comm/bottom.jsp" />
<script type="text/javascript">
	$("#searchBtn").click(function() {
		$("#search").submit();
	});
	
	function query(type, value) {
		if (type == 1) {
			$("#categoryId").val(value);
		}else if (type == 2) {
			$("#areaId").val(value);
		}else if(type == 3) {
			$("#pubtime").val(value);
		}else if (type == 4) {
			$("#tagId").val(value);
		}
		$("#search").submit();
	}
	
	function page(pageNum) {
		$("#superPage").val(pageNum);
		$("#search").submit();
		
	}
	
	function setPageSize(pageSize) {
		$("#pageSize").val(pageSize);
		$("#search").submit();
	}
</script>
